
#import "FTDrawDelegate.h"
#import "../Solitaire/CardSet.subproj/cardset.h"
#import "localstrings.h"

@implementation FTDrawDelegate

- setDiscardCardPileView:theView
{
    discardPileView = theView;
    return self;
}


- clickedCard:aCard in:drawCardPileView
{
    id    drawCardPile = [drawCardPileView cardPile];
    id    discardPile = [discardPileView cardPile];
    id    drawCard;
    
    if ([drawCardPile cardCount])
    {
	[[drawCardPileView window] disableFlushWindow];
	drawCard = [drawCardPile cardAt:CS_TOP];
	[drawCardPile removeCard:drawCard];
	[drawCard flip];
	[discardPile addCard:drawCard];
	[drawCardPileView display];
	[discardPileView display];
	[[drawCardPileView window] reenableFlushWindow];
	[[drawCardPileView window] flushWindow];
    }
    else{
	NXRunAlertPanel(LOCALIZED_GAME_NAME,LOCALIZED_NO_STOCK_CARD,
	"OK", NULL, NULL);
    }

    return self;
}


@end
